<template>
	<view v-if="showCon" class="u-page c-wrap">
		<listtemplate :sid="sp.id" v-if="param.tabindex==0"></listtemplate>
		<metemplate v-if="param.tabindex==1"></metemplate>

		<u-tabbar :value="param.tabindex" :fixed="true" :placeholder="true" :safeAreaInsetBottom="false">
			<u-tabbar-item :text="$t('clogin.tab.home')" icon="home" @click="clickBottomtab"></u-tabbar-item>
			<u-tabbar-item :text="$t('clogin.tab.me')" icon="account" @click="clickBottomtab"></u-tabbar-item>
		</u-tabbar>
	</view>
  <view class="body" v-else>请用微信打开 ···</view>
</template>

<script>
	import listtemplate from '@/pages/csmwj/home/template/listtemplate.vue';
	import metemplate from '@/pages/clogin/components/metemplate.vue';

	export default {
		components: {
			listtemplate,
			metemplate
		},
		data() {
			return {
				sp: {
					locales: null,
				},
				param: {
					tabindex: 0,
				},
				sr: {
					list: []
				},
        showCon:false
			}
		},
		onLoad(options) {
			let that = this;
      this.showCon = this.isWeiXin(options.open_type)
		},
		onShow() {
			let that = this;
			that.cinit();
		},
		methods: {
      isWeiXin(type) {
        var ua = navigator.userAgent.toLowerCase();
        if(type == 1){
          return true;
        }else if (ua.indexOf('micromessenger') > -1) {
          return true; // 在微信中打开
        } else {
          return false; // 在普通浏览器中打开
        }
      },
			cinit() {
				let that = this;

			},
			clickBottomtab: function(e) {
				let that = this;
				that.param.tabindex = e;
			},
		}
	}
</script>

<style scoped lang="scss">
  .body{width: 100%; height: 100vh; background-color: #FFF; display: flex;justify-content: center; box-sizing: border-box; padding-top: 20vh; letter-spacing: 1px;}
	.a-top-notice {
		position: fixed;
		left: 0px;
		top: 0px;
		background-color: #9c9c9c;
		color: red;
		line-height: 60rpx;
		font-size: 36rpx;
		text-align: center;
		width: 100%;
		font-weight: bold;
	}

	.a-top-notice-fillblank {
		height: 60rpx;
	}

	.u-radio-group {
		width: 100%;
	}
</style>
